From 4ebfea3d358eb22e62a1de0740eefbfc5db197af Mon Sep 17 00:00:00 2001 From: tsteven4 <13596209+tsteven4@users.noreply.github.com> Date: Sun, 2 Jan 2022 12:22:11 -0700 Subject: [PATCH] make gbversion.h, setup.iss generated files. (#806) * make gbversion.h, setup.iss generated files. add cmake documentation targets. * work on check. * simplify parameter passing to test scripts. * cmake test work. run vtesto in parallel. fix valgrind decision making in testo. fix test for gpsbabel executable with blanks in path. * update vtesto for cmake. * simplify option passing for testo. * simplify valgrind detection in testo. * fix testo bug. * add ubuntu cmake build. * fix workflow * align gui pro and CMakeLists. and use target properties --- .github/workflows/ubuntu.yml | 16 +++++ .gitignore | 2 + CMakeLists.txt | 58 +++++++++++++++++- GPSBabel.pro | 45 ++++---------- gbversion.cmake | 30 ++++++++++ gbversion.h | 17 ------ gbversion.h.in | 10 ++-- gbversion.pri | 36 +++++++++++ gui/.gitignore | 2 + gui/CMakeLists.txt | 12 +++- gui/app.pro | 24 +++++--- gui/app.rc | 2 +- gui/mainwindow.cc | 2 +- gui/setup.iss | 86 --------------------------- gui/setup.iss.in | 10 +++- gui/setup.iss.qmake.in | 10 +++- gui/upgrade.cc | 2 +- testo | 32 ++++++---- testo.d/track-discard.test | 2 +- testo.d/validate.test | 2 +- testo.d/xol.test | 2 +- tools/.gitignore | 1 + tools/build_and_test_cmake | 46 ++++++++++++++ tools/make_gpsbabel_org_wrapper.sh.in | 5 ++ tools/make_windows_release.ps1 | 3 +- vtesto | 14 +++-- win32/gpsbabel.rc | 2 +- 27 files changed, 285 insertions(+), 188 deletions(-) create mode 100644 gbversion.cmake delete mode 100644 gbversion.h create mode 100644 gbversion.pri delete mode 100644 gui/setup.iss create mode 100755 tools/build_and_test_cmake create mode 100755 tools/make_gpsbabel_org_wrapper.sh.in diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 3b2edc22d..b4ecbf5ab 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -26,6 +26,22 @@ jobs: run: | ./build_and_test + cmake: + name: cmake Build + runs-on: ubuntu-latest + container: + image: gpsbabel-docker.jfrog.io/tsteven4/gpsbabel_build_environment_focal + env: + LC_ALL: 'C.UTF-8' + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: build_and_test + run: | + ./tools/build_and_test_cmake + qtio_gcc: name: qtio gcc Build runs-on: ubuntu-latest diff --git a/.gitignore b/.gitignore index bf6fddde4..957c3cac4 100644 --- a/.gitignore +++ b/.gitignore @@ -40,3 +40,5 @@ CMakeFiles/ /autogen/ /makedoc /empty +/gbversion.h +/qrc_gpsbabel.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 5d5868ac2..fa6d0dfaf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,8 @@ cmake_minimum_required(VERSION 3.11) -project(gpsbabel LANGUAGES C CXX) +include(gbversion.cmake) +configure_file(gbversion.h.in gbversion.h @ONLY NEWLINE_STYLE LF) +project(gpsbabel LANGUAGES C CXX VERSION ${GB.VERSION}) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED True) @@ -422,6 +424,56 @@ get_target_property(IncDirs gpsbabel INCLUDE_DIRECTORIES) message(STATUS "Include Directores are: \"${IncDirs}\"") if(UNIX) - # the tests only work if the pwd is top level source dir due to the file name getting embedded in the file nonexistent.err. - add_custom_target(check cd ${CMAKE_SOURCE_DIR}\; PNAME=${CMAKE_BINARY_DIR}/gpsbabel ./testo DEPENDS gpsbabel) + # This test only works if the pwd is top level source dir due to the + # file name getting embedded in the file nonexistent.err. + add_custom_target(check + ${CMAKE_SOURCE_DIR}/testo -p $ + DEPENDS gpsbabel + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + VERBATIM) +endif() +if(UNIX AND NOT APPLE) + # This test only works if the pwd is top level source dir due to the + #file name getting embedded in the file nonexistent.err. + file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/testo.d) + add_custom_target(check-vtesto + find testo.d -maxdepth 1 -name "*.test" -print0 | xargs -0 basename -s .test | sort | + xargs -n 1 -P 3 -I TESTNAME ${CMAKE_SOURCE_DIR}/vtesto + -l -j ${CMAKE_BINARY_DIR}/testo.d/TESTNAME.vglog -p $ TESTNAME + DEPENDS gpsbabel + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + VERBATIM) +endif() + +if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR) + set(WEB "../babelweb" CACHE PATH "Path where the documentation will be stored for www.gpsbabel.org.") + # If using a makefile generator WEB can be overridden on the make + # command line, e.g. make gpsbabel.org WEB=/tmp. If not overridden on + # the make command line, or not using a makefile generator, or if using + # "cmake --build dir --target gpsbabel.org", then the cache variable + # WEB will be used. The cache variable can be overridden in the usual + # way when configuring, i.e. "cmake dir -DWEB:PATH=/tmp". + + # FIXME: Is overriding WEB on the make command line worth the trouble of + # using configure_file to build a wrapper script? + + configure_file(${CMAKE_SOURCE_DIR}/tools/make_gpsbabel_org_wrapper.sh.in + ${CMAKE_BINARY_DIR}/tools/make_gpsbabel_org_wrapper.sh + @ONLY + NEWLINE_STYLE LF) + add_custom_target(gpsbabel.org + ${CMAKE_BINARY_DIR}/tools/make_gpsbabel_org_wrapper.sh + DEPENDS gpsbabel gpsbabel.pdf) +endif() + +if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR) + add_custom_target(gpsbabel.html + ${CMAKE_SOURCE_DIR}/tools/make_gpsbabel_html.sh + DEPENDS gpsbabel) +endif() + +if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR) + add_custom_target(gpsbabel.pdf + ${CMAKE_SOURCE_DIR}/tools/make_gpsbabel_pdf.sh + DEPENDS gpsbabel) endif() diff --git a/GPSBabel.pro b/GPSBabel.pro index a1b29a38b..dfb828529 100644 --- a/GPSBabel.pro +++ b/GPSBabel.pro @@ -1,5 +1,5 @@ # Enforce minimum Qt version. -# versionAtLeast() was introduced in Qt 5.10, so we can't count on it being available. +# versionAtLeast() was introduced in Qt 5.10, so we cannot count on it being available. MIN_QT_VERSION = 5.12 # major[.minor[.patch]] MIN_QT_VERSION_COMPONENTS = $$split(MIN_QT_VERSION, .) MIN_QT_VERSION_MAJOR = $$member(MIN_QT_VERSION_COMPONENTS, 0) @@ -16,8 +16,11 @@ if(equals(QT_MAJOR_VERSION, $$MIN_QT_VERSION_MAJOR):equals(QT_MINOR_VERSION, $$M QT -= gui versionAtLeast(QT_VERSION, 6.0): QT += core5compat +# set VERSION related variables and generate gbversion.h +include(gbversion.pri) + TARGET = gpsbabel -VERSION = 1.7.0 +VERSION = $$GB.VERSION CONFIG += console CONFIG -= app_bundle @@ -26,35 +29,6 @@ CONFIG += link_pkgconfig TEMPLATE = app -# use GB variable to express ownership intention and -# avoid conflict with documented and undocumented qmake variables -GB.VERSION_COMPONENTS = $$split(VERSION, .) -GB.MAJOR = $$member(GB.VERSION_COMPONENTS, 0) -GB.MINOR = $$member(GB.VERSION_COMPONENTS, 1) -GB.MICRO = $$member(GB.VERSION_COMPONENTS, 2) -# Increase GB.BUILD for a new release (why? Where is this ever used?) -# A: it's used by win32/gpsbabel.rc which includes gbversion.h -GB.BUILD = 31 -# GB.PACKAGE_RELEASE = "-beta20190413" - -# may be overwridden on qmake command line -!defined(DOCVERSION, var) { - DOCVERSION=$${VERSION} -} - -# may be overwridden on qmake command line -!defined(WEB, var) { - WEB = ../babelweb -} - -# use undocumented QMAKE_SUBSTITUTES variable to emulate AC_CONFIG_FILES -GB.versionfile.input = gbversion.h.qmake.in -GB.versionfile.output = gbversion.h -QMAKE_SUBSTITUTES += GB.versionfile -GB.setupfile.input = gui/setup.iss.qmake.in -GB.setupfile.output = gui/setup.iss -QMAKE_SUBSTITUTES += GB.setupfile - # RESOURCES RESOURCES = gpsbabel.qrc @@ -420,9 +394,14 @@ QMAKE_EXTRA_TARGETS += cppcheck gpsbabel.org.depends = gpsbabel gpsbabel.pdf FORCE equals(PWD, $${OUT_PWD}) { + # may be overridden on qmake command line + !defined(WEB, var) { + WEB = ../babelweb + } + # Allow WEB to be overridden when running make. + # DOCVERSION must be overridden at qmake time as it also affects the object code. gpsbabel.org.commands += web=\$\${WEB:-$${WEB}}; - gpsbabel.org.commands += docversion=\$\${DOCVERSION:-$${DOCVERSION}}; - gpsbabel.org.commands += tools/make_gpsbabel_org.sh \"\$\${web}\" \"\$\${docversion}\"; + gpsbabel.org.commands += tools/make_gpsbabel_org.sh \"\$\${web}\" $$shell_quote($$DOCVERSION); } else { gpsbabel.org.commands += echo "target gpsbabel.org is not supported for out of source builds."; gpsbabel.org.commands += exit 1; diff --git a/gbversion.cmake b/gbversion.cmake new file mode 100644 index 000000000..0195e4296 --- /dev/null +++ b/gbversion.cmake @@ -0,0 +1,30 @@ +# Use GB variable to express ownership intention and avoid conflict with +# documented and undocumented cmake variables. + +# Until we do a hierarchical build the build directory for gpsbabel and +# the build directory for GPSBabelFE are independent. Only the source +# directories have a known relationship. Including this pri file from the +# source tree will generate the version file in the current build directory. + +# Note some of these variables are also used in the gui to generate setup.iss. +# Note some of these variables are also used in the cli to generate documents. + +# FIXME: when we have a hierarchical build we can set the version directly +# in the top level CMakeLists.txt file, and the version components will +# be automatically available in as variables. But today we have multiple +# independent CMakeLists.txt files all with their own project commands. +# By defining the version here we minimize the number of locations +# containing the definition to gbversion.pri and gbversion.cmake. + +set(GB.VERSION 1.7.0) # also change in gbversion.pri +string(REPLACE "." ";" VERSION_COMPONENTS ${GB.VERSION}) +list(GET VERSION_COMPONENTS 0 GB.MAJOR) +list(GET VERSION_COMPONENTS 1 GB.MINOR) +list(GET VERSION_COMPONENTS 2 GB.MICRO) +# Increase GB.BUILD for a new release (why? Where is this ever used?) +# A: it's used by win32/gpsbabel.rc which includes gbversion.h +set(GB.BUILD 31 CACHE STRING "Fourth component of Windows VERSIONINFO resource FILEVERSION and PRODUCTVERSION parameters.") +set(GB.PACKAGE_RELEASE "" CACHE STRING "String to append to VERSION tuple.") # .e.g. "-beta20190413" + +# may be overridden on cmake command line +set(DOCVERSION ${GB.VERSION} CACHE STRING "String appended to documentation location for www.gpsbabel.org.") diff --git a/gbversion.h b/gbversion.h deleted file mode 100644 index baac2f459..000000000 --- a/gbversion.h +++ /dev/null @@ -1,17 +0,0 @@ -/* - * gbversion.h is generated from gbversion.h.in which uses autoconf voodoo - * to get the version number from configure.ac. - * - * Isn't simplification via automation grand? - */ -#ifdef RC_INVOKED -// These defines are for the Microsoft resource compiler scripts -// win32/gpsbabel.rc and gui/app.rc -#define VER_FILE 1,7,0,31 -#define VER_PRODUCT 1,7,0,31 -#define VER_FILE_STR "1.7.0" -#define VER_PRODUCT_STR "1.7.0" -#else -#define VERSION "1.7.0" -#define WEB_DOC_DIR "https://www.gpsbabel.org/htmldoc-1.7.0" -#endif diff --git a/gbversion.h.in b/gbversion.h.in index 6e8c7e309..4778bfb39 100644 --- a/gbversion.h.in +++ b/gbversion.h.in @@ -7,11 +7,11 @@ #ifdef RC_INVOKED // These defines are for the Microsoft resource compiler scripts // win32/gpsbabel.rc and gui/app.rc -#define VER_FILE @GBMAJOR@,@GBMINOR@,@GBMICRO@,@GBBUILD@ -#define VER_PRODUCT @GBMAJOR@,@GBMINOR@,@GBMICRO@,@GBBUILD@ -#define VER_FILE_STR "@GBMAJOR@.@GBMINOR@.@GBMICRO@@PACKAGE_RELEASE@" -#define VER_PRODUCT_STR "@GBMAJOR@.@GBMINOR@.@GBMICRO@@PACKAGE_RELEASE@" +#define VER_FILE @GB.MAJOR@,@GB.MINOR@,@GB.MICRO@,@GB.BUILD@ +#define VER_PRODUCT @GB.MAJOR@,@GB.MINOR@,@GB.MICRO@,@GB.BUILD@ +#define VER_FILE_STR "@GB.MAJOR@.@GB.MINOR@.@GB.MICRO@@GB.PACKAGE_RELEASE@" +#define VER_PRODUCT_STR "@GB.MAJOR@.@GB.MINOR@.@GB.MICRO@@GB.PACKAGE_RELEASE@" #else -#define VERSION "@GBMAJOR@.@GBMINOR@.@GBMICRO@@PACKAGE_RELEASE@" +#define VERSION "@GB.MAJOR@.@GB.MINOR@.@GB.MICRO@@GB.PACKAGE_RELEASE@" #define WEB_DOC_DIR "https://www.gpsbabel.org/htmldoc-@DOCVERSION@" #endif diff --git a/gbversion.pri b/gbversion.pri new file mode 100644 index 000000000..9967e9700 --- /dev/null +++ b/gbversion.pri @@ -0,0 +1,36 @@ +# Use GB variable to express ownership intention and avoid conflict with +# documented and undocumented qmake variables. + +# Until we do a hierarchical build the build directory for gpsbabel and +# the build directory for GPSBabelFE are independent. Only the source +# directories have a known relationship. Including this pri file from the +# source tree will generate the version file in the current build directory. + +# Note some of these variables are also used in the gui to generate setup.iss. +# Note some of these variables are also used in the cli to generate documents. + +# FIXME: Today we have multiple independent .pro files. By defining +# the version here we minimize the number of locations containing the +# definition to gbversion.pri and gbversion.cmake. When we retire qmake +# we will be back to only one place for version to be defined. + +GB.VERSION = 1.7.0 # Also change in gbversion.cmake +GB.VERSION_COMPONENTS = $$split(GB.VERSION, .) +GB.MAJOR = $$member(GB.VERSION_COMPONENTS, 0) +GB.MINOR = $$member(GB.VERSION_COMPONENTS, 1) +GB.MICRO = $$member(GB.VERSION_COMPONENTS, 2) +# Increase GB.BUILD for a new release (why? Where is this ever used?) +# A: it's used by win32/gpsbabel.rc which includes gbversion.h +GB.BUILD = 31 +# GB.PACKAGE_RELEASE = "-beta20190413" + +# may be overridden on qmake command line +!defined(DOCVERSION, var) { +DOCVERSION=$${GB.VERSION} +} + +# use undocumented QMAKE_SUBSTITUTES variable to emulate AC_CONFIG_FILES +# Note $${PWD} is relative to the location of this file. +GB.versionfile.input = $${PWD}/gbversion.h.qmake.in +GB.versionfile.output = gbversion.h +QMAKE_SUBSTITUTES += GB.versionfile diff --git a/gui/.gitignore b/gui/.gitignore index c98deaa4b..91b4294fe 100644 --- a/gui/.gitignore +++ b/gui/.gitignore @@ -8,3 +8,5 @@ /tmp/ /release/ /debug/ +/gbversion.h +/setup.iss diff --git a/gui/CMakeLists.txt b/gui/CMakeLists.txt index a4d16a106..bc62bc5af 100644 --- a/gui/CMakeLists.txt +++ b/gui/CMakeLists.txt @@ -1,6 +1,9 @@ cmake_minimum_required(VERSION 3.11) -project(gpsbabelfe LANGUAGES CXX) +include(../gbversion.cmake) +configure_file(../gbversion.h.in gbversion.h @ONLY NEWLINE_STYLE LF) +configure_file(setup.iss.in setup.iss @ONLY NEWLINE_STYLE CRLF) +project(gpsbabelfe LANGUAGES CXX VERSION ${GB.VERSION}) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED True) @@ -16,7 +19,6 @@ set(CMAKE_AUTORCC ON) if(UNIX AND NOT APPLE) set(TARGET gpsbabelfe) - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY GPSBabelFE) else() set(TARGET GPSBabelFE) endif() @@ -41,8 +43,12 @@ else() target_compile_definitions(${TARGET} PRIVATE DISABLE_MAPPREVIEW) endif() -list(APPEND RESOURCES app.qrc) +if(UNIX AND NOT APPLE) + set_target_properties(${TARGET} PROPERTIES RUNTIME_OUTPUT_DIRECTORY GPSBabelFE) +endif() +# RESOURCES +list(APPEND RESOURCES app.qrc) if(WIN32) list(APPEND RESOURCES app.rc) endif() diff --git a/gui/app.pro b/gui/app.pro index a0357fb73..81385bf5b 100755 --- a/gui/app.pro +++ b/gui/app.pro @@ -1,6 +1,15 @@ # $Id: app.pro,v 1.19 2010-11-01 03:30:42 robertl Exp $ # +# set VERSION related variables and generate gbversion.h +include(../gbversion.pri) + +GB.setupfile.input = setup.iss.qmake.in +GB.setupfile.output = setup.iss +QMAKE_SUBSTITUTES += GB.setupfile + +VERSION = $$GB.VERSION + #CONFIG += qt causes link failure on msvc. Qt6EntryPoint.lib not added to libs. CONFIG(debug, debug|release) { CONFIG += console @@ -30,21 +39,23 @@ mac:DESTDIR = . UI_DIR = tmp -RESOURCES = app.qrc -RC_FILE = app.rc - -win32 { +unix:!mac{ + TARGET=gpsbabelfe +} else { TARGET=GPSBabelFE } + win32-g++ { QMAKE_LFLAGS_RELEASE += -static-libgcc } -unix:TARGET=gpsbabelfe -mac:TARGET=GPSBabelFE # Set QMAKE_TARGET_BUNDLE_PREFIX so we get the correct CFBundleIdentifier in Info.plist darwin:QMAKE_TARGET_BUNDLE_PREFIX=org.gpsbabel +# RESOURCES +RESOURCES = app.qrc +RC_FILE = app.rc + # FORMS FORMS += aboutui.ui FORMS += advui.ui @@ -156,4 +167,3 @@ macx|linux{ QMAKE_EXTRA_TARGETS += compile_command_database QMAKE_DISTCLEAN += compile_commands.json } - diff --git a/gui/app.rc b/gui/app.rc index b53f37499..a949054d3 100644 --- a/gui/app.rc +++ b/gui/app.rc @@ -1,5 +1,5 @@ #include -#include "../gbversion.h" +#include "gbversion.h" IDI_ICON1 ICON "images/appicon.ico" diff --git a/gui/mainwindow.cc b/gui/mainwindow.cc index 8ff9b058c..d4b153b50 100644 --- a/gui/mainwindow.cc +++ b/gui/mainwindow.cc @@ -58,7 +58,7 @@ #include // for exit #include "mainwindow.h" -#include "../gbversion.h" // for VERSION +#include "gbversion.h" // for VERSION #include "aboutdlg.h" // for AboutDlg #include "advdlg.h" // for AdvDlg #include "appname.h" // for appName diff --git a/gui/setup.iss b/gui/setup.iss deleted file mode 100644 index e82a5fb67..000000000 --- a/gui/setup.iss +++ /dev/null @@ -1,86 +0,0 @@ -; -; NOTE: setup.iss is generated from setup.iss.in via configure. -; The generated setup.iss is checked in to help keep the version numbers -; synchronized. -; -; Script for generating installation setup program for GPSBabel -; Uses the Inno setup compiler. -; windeployqt should be run to prepare the necessary Qt files before -; running Inno Setup. -#ifndef package_dir - #define package_dir "..\build-app-Desktop-Release\package" -#endif - -[Setup] -; NOTE: The value of AppId uniquely identifies this application. -; Do not use the same AppId value in installers for other applications. -; (To generate a new GUID, click Tools | Generate GUID inside the IDE.) -AppId={{1B8FE958-A304-4902-BF7A-4E2F0F5B7017} -AppName=GPSBabel -AppVerName=GPSBabel 1.7.0 -AppPublisher=GPSBabel -AppPublisherURL=https://www.gpsbabel.org -AppSupportURL=https://www.gpsbabel.org -AppUpdatesURL=https://www.gpsbabel.org -ArchitecturesAllowed=x64 -ArchitecturesInstallIn64BitMode=x64 -DefaultDirName={pf}\GPSBabel -DefaultGroupName=GPSBabel -OutputDir=release -OutputBaseFilename=GPSBabel-1.7.0-Setup -OutputManifestFile=GPSBabel-1.7.0-Manifest.txt -SetupIconFile=images\babel2.ico -Compression=lzma -SolidCompression=yes -LicenseFile=COPYING.txt - -[Languages] -Name: "english"; MessagesFile: "compiler:Default.isl" - -[Tasks] -Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked - -[Files] -Source: gmapbase.html; DestDir: "{app}"; Flags: ignoreversion -Source: qt.conf; DestDir: "{app}"; Flags: ignoreversion - -Source: "{#package_dir}\*"; Excludes: "vc_redist.*.exe"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs -Source: "{#package_dir}\vc_redist.x86.exe"; DestDir: "{app}"; Flags: ignoreversion skipifsourcedoesntexist deleteafterinstall -Source: "{#package_dir}\vc_redist.x64.exe"; DestDir: "{app}"; Flags: ignoreversion skipifsourcedoesntexist deleteafterinstall -Source: "{#package_dir}\gpsbabel.exe"; DestDir: "{app}"; Flags: ignoreversion -; Source: release\help\*; DestDir: "{app}\help"; Flags: ignoreversion recursesubdirs createallsubdirs - -; Translation strings extracted from source code. Include it in the dist -; so that users can translate if they want to. -; Source: gpsbabel_*.ts; DestDir: "{app}\translations"; Flags: ignoreversion -; Source: gpsbabelfe_*.ts; DestDir: "{app}\translations"; Flags: ignoreversion - -; Compiled translation strings that are used at runtime. -Source: coretool\gpsbabel_*.qm; DestDir: "{app}\translations"; Flags: ignoreversion -Source: gpsbabelfe_*.qm; DestDir: "{app}\translations"; Flags: ignoreversion - -; Miscellaneous -Source: COPYING.txt; DestDir: {app}; Flags: ignoreversion -; Source: AUTHORS; DestDir: {app}; Flags: ignoreversion -; Source: README.contrib; DestDir: {app}; Flags: ignoreversion -; Source: README.gui; DestDir: {app}; Flags: ignoreversion - - -; NOTE: Don't use "Flags: ignoreversion" on any shared system files - -[Icons] -Name: "{group}\GPSBabel"; Filename: "{app}\gpsbabelfe.exe" -Name: "{commondesktop}\GPSBabel"; Filename: "{app}\gpsbabelfe.exe"; Tasks: desktopicon - -[Run] -Filename: "{app}\vc_redist.x86.exe"; Parameters: "/quiet"; Flags: skipifdoesntexist -Filename: "{app}\vc_redist.x64.exe"; Parameters: "/quiet"; Flags: skipifdoesntexist -Filename: "{app}\gpsbabelfe.exe"; Description: "{cm:LaunchProgram,GPSBabelFE}"; Flags: nowait postinstall skipifsilent - -[Registry] -Root: HKCU; Subkey: "Software\GPSBabel"; Flags: uninsdeletekeyifempty -Root: HKCU; Subkey: "Software\GPSBabel\GPSBabel"; Flags: uninsdeletekey -Root: HKCU; Subkey: "Software\GPSBabel\GPSBabelFE"; Flags: uninsdeletekey - -; ISPP preprocessor output can be useful for debug -#expr SaveToFile("PreprocessedScript.iss") diff --git a/gui/setup.iss.in b/gui/setup.iss.in index 09560192d..6074353ba 100644 --- a/gui/setup.iss.in +++ b/gui/setup.iss.in @@ -10,6 +10,9 @@ #ifndef package_dir #define package_dir "..\build-app-Desktop-Release\package" #endif +#ifndef source_dir + #define source_dir "." +#endif [Setup] ; NOTE: The value of AppId uniquely identifies this application. @@ -17,7 +20,7 @@ ; (To generate a new GUID, click Tools | Generate GUID inside the IDE.) AppId={{1B8FE958-A304-4902-BF7A-4E2F0F5B7017} AppName=GPSBabel -AppVerName=GPSBabel @PACKAGE_VERSION@@PACKAGE_RELEASE@ +AppVerName=GPSBabel @GB.VERSION@@GB.PACKAGE_RELEASE@ AppPublisher=GPSBabel AppPublisherURL=https://www.gpsbabel.org AppSupportURL=https://www.gpsbabel.org @@ -27,11 +30,12 @@ ArchitecturesInstallIn64BitMode=x64 DefaultDirName={pf}\GPSBabel DefaultGroupName=GPSBabel OutputDir=release -OutputBaseFilename=GPSBabel-@PACKAGE_VERSION@@PACKAGE_RELEASE@-Setup -OutputManifestFile=GPSBabel-@PACKAGE_VERSION@@PACKAGE_RELEASE@-Manifest.txt +OutputBaseFilename=GPSBabel-@GB.VERSION@@GB.PACKAGE_RELEASE@-Setup +OutputManifestFile=GPSBabel-@GB.VERSION@@GB.PACKAGE_RELEASE@-Manifest.txt SetupIconFile=images\babel2.ico Compression=lzma SolidCompression=yes +SourceDir="{#source_dir}" LicenseFile=COPYING.txt [Languages] diff --git a/gui/setup.iss.qmake.in b/gui/setup.iss.qmake.in index 4ffb4c72a..81c2b78c0 100644 --- a/gui/setup.iss.qmake.in +++ b/gui/setup.iss.qmake.in @@ -10,6 +10,9 @@ #ifndef package_dir #define package_dir \"..\\build-app-Desktop-Release\\package\" #endif +#ifndef source_dir + #define source_dir "." +#endif [Setup] ; NOTE: The value of AppId uniquely identifies this application. @@ -17,7 +20,7 @@ ; (To generate a new GUID, click Tools | Generate GUID inside the IDE.) AppId={{1B8FE958-A304-4902-BF7A-4E2F0F5B7017} AppName=GPSBabel -AppVerName=GPSBabel $${VERSION}$${GB.PACKAGE_RELEASE} +AppVerName=GPSBabel $${GB.VERSION}$${GB.PACKAGE_RELEASE} AppPublisher=GPSBabel AppPublisherURL=https://www.gpsbabel.org AppSupportURL=https://www.gpsbabel.org @@ -27,11 +30,12 @@ ArchitecturesInstallIn64BitMode=x64 DefaultDirName={pf}\\GPSBabel DefaultGroupName=GPSBabel OutputDir=release -OutputBaseFilename=GPSBabel-$${VERSION}$${GB.PACKAGE_RELEASE}-Setup -OutputManifestFile=GPSBabel-$${VERSION}$${GB.PACKAGE_RELEASE}-Manifest.txt +OutputBaseFilename=GPSBabel-$${GB.VERSION}$${GB.PACKAGE_RELEASE}-Setup +OutputManifestFile=GPSBabel-$${GB.VERSION}$${GB.PACKAGE_RELEASE}-Manifest.txt SetupIconFile=images\\babel2.ico Compression=lzma SolidCompression=yes +SourceDir=\"{#source_dir}\" LicenseFile=COPYING.txt [Languages] diff --git a/gui/upgrade.cc b/gui/upgrade.cc index 2affa3dd4..b17f67270 100644 --- a/gui/upgrade.cc +++ b/gui/upgrade.cc @@ -38,7 +38,7 @@ #include // for QDomElement #include // for QDomNode #include // for QDomNodeList -#include "../gbversion.h" // for VERSION +#include "gbversion.h" // for VERSION #include "babeldata.h" // for BabelData #include "format.h" // for Format diff --git a/testo b/testo index b4ff2c502..7ce64da08 100755 --- a/testo +++ b/testo @@ -11,6 +11,15 @@ export MALLOC_CHECK_ LC_ALL=en_US.UTF-8 export LC_ALL +while : +do + case "$1" in + -p) PNAME=$2; shift 2;; + -v) VALGRIND=$2; shift 2;; + *) break;; + esac +done + BASEPATH=`dirname $0` PNAME=${PNAME:-${BASEPATH}/gpsbabel} DIFF=${DIFF:-diff} @@ -22,9 +31,6 @@ else OD=${OD:-od -Ax -txC -v} fi XMLWF=xmlwf -# set up a variable so we can skip extra tests when running valgrind -echo "${PNAME}" | grep -q valgrind -RUNNINGVALGRIND=$? TMPDIR=${GBTEMP:-/tmp}/gpsbabel.$$ mkdir -p $TMPDIR @@ -84,17 +90,17 @@ sort_and_compare() gpsbabel() { - ${PNAME} "$@" || { - echo "$PNAME returned error $?" - echo "($PNAME $@)" - errorcount=`expr $errorcount + 1` - #exit 1 - } + ${VALGRIND} "${PNAME}" "$@" || { + echo "$PNAME returned error $?" + echo "($PNAME $@)" + errorcount=`expr $errorcount + 1` + #exit 1 + } } utf8bomcheck() { - if [ ${RUNNINGVALGRIND} -ne 0 ]; then + if [ -z "${VALGRIND}" ]; then if [ "$(dd if=$1 bs=1 count=3 2>/dev/null)" = $'\xef\xbb\xbf' ]; then echo "ERROR: UTF-8 BOM found in $1" errorcount=`expr $errorcount + 1` @@ -104,7 +110,7 @@ utf8bomcheck() xmlwfcheck() { - if [ ${RUNNINGVALGRIND} -ne 0 ]; then + if [ -z "${VALGRIND}" ]; then if which ${XMLWF} >/dev/null 2>&1; then # xmlwf is a bit lame, exit status is always 0 rm -f ${TMPDIR}/xmlwf.out @@ -158,7 +164,7 @@ fi #cp LineStyles.gpx.badchar ${TMPDIR}/bad.gpx XMLS=$(find ${TMPDIR} -name "*.gpx" -o -name "*.kml") -if [ ${RUNNINGVALGRIND} -ne 0 ]; then +if [ -z "${VALGRIND}" ]; then echo "Running UTF-8 BOM test" for i in ${XMLS} do @@ -166,7 +172,7 @@ if [ ${RUNNINGVALGRIND} -ne 0 ]; then done fi -if [ ${RUNNINGVALGRIND} -ne 0 ]; then +if [ -z "${VALGRIND}" ]; then if which ${XMLWF} >/dev/null 2>&1; then echo "Running well-formed XML test" for i in ${XMLS} diff --git a/testo.d/track-discard.test b/testo.d/track-discard.test index 539b16478..9d76183dd 100644 --- a/testo.d/track-discard.test +++ b/testo.d/track-discard.test @@ -6,7 +6,7 @@ rm -f ${TMPDIR}/discard* # gpx file with points with missing timestamps (has 4 trkpts, 2 duplicate times, 1 missing time, expect merge to output 2 valid trkpts) # expecting this to fail during a standard -x track,merge so call directly rather than via gpsbabel function -${PNAME} -t -i gpx -f ${REFERENCE}/track/trackfilter_discard.gpx -x track,merge -o csv -F - 2> ${TMPDIR}/discard.err && { +${VALGRIND} "${PNAME}" -t -i gpx -f ${REFERENCE}/track/trackfilter_discard.gpx -x track,merge -o csv -F - 2> ${TMPDIR}/discard.err && { echo "$PNAME succeeded! (it shouldn't have with this input...)" } # check error message is what we expected diff --git a/testo.d/validate.test b/testo.d/validate.test index 64b8f3a4b..506e7f754 100644 --- a/testo.d/validate.test +++ b/testo.d/validate.test @@ -2,7 +2,7 @@ gpsbabel -i gpx -f ${REFERENCE}/basecamp.gpx -x validate,debug > /dev/null 2> ${ compare ${REFERENCE}/validate_debug.log ${TMPDIR}/validate_debug.log # expecting this to fail so call directly rather than via gpsbabel function -${PNAME} -i gpx -f ${REFERENCE}/empty.gpx -x validate,checkempty > /dev/null 2> ${TMPDIR}/validate_empty.log && { +${VALGRIND} "${PNAME}" -i gpx -f ${REFERENCE}/empty.gpx -x validate,checkempty > /dev/null 2> ${TMPDIR}/validate_empty.log && { echo "${PNAME} succeeded! (it shouldn't have with this input...)" } compare ${REFERENCE}/validate_empty.log ${TMPDIR}/validate_empty.log diff --git a/testo.d/xol.test b/testo.d/xol.test index 94f69450d..b57df3181 100644 --- a/testo.d/xol.test +++ b/testo.d/xol.test @@ -12,7 +12,7 @@ compare ${REFERENCE}/xol-sample.gpx ${TMPDIR}/xol-sample.gpx # check xmlgeneric can detect no input file # we expect this to fail rm -f ${TMPDIR}/xol-sample_si.gpx -${PNAME} -i xol -f ${REFERENCE}/doesnotexist -o gpx -F ${TMPDIR}/xol-sample_si.gpx 2> ${TMPDIR}/nonexistent.err && { +${VALGRIND} "${PNAME}" -i xol -f ${REFERENCE}/doesnotexist -o gpx -F ${TMPDIR}/xol-sample_si.gpx 2> ${TMPDIR}/nonexistent.err && { echo "${PNAME} succeeded! (it shouldn't have with this input...)" } # check error message is what we expected. diff --git a/tools/.gitignore b/tools/.gitignore index 9ceead247..9b2452f41 100644 --- a/tools/.gitignore +++ b/tools/.gitignore @@ -1 +1,2 @@ /mkcapabilities +/make_gpsbabel_org_wrapper.sh diff --git a/tools/build_and_test_cmake b/tools/build_and_test_cmake new file mode 100755 index 000000000..717e91d6b --- /dev/null +++ b/tools/build_and_test_cmake @@ -0,0 +1,46 @@ +#!/bin/bash -ex +# +# this script is triggered by SCM changes and is run on the build server. +# output is conditionally mailed to gpsbabel-code. +# +# echo some system info to log +uname -a +if [ -e /etc/system-release ]; then + cat /etc/system-release +fi +if [ -e /etc/os-release ]; then + cat /etc/os-release +fi +git --no-pager log -n 1 +# build and test keeping output within the pwd. +export GBTEMP=$(pwd)/gbtemp +mkdir -p $GBTEMP +cmake . -G Ninja -DCMAKE_BUILD_TYPE=Release -DWEB=$(pwd)/gpsbabel_docdir +# As of 2018-10, all the virtualized travis build images are two cores per: +# https://docs.travis-ci.com/user/reference/overview/ +# We'll be slightly abusive on CPU knowing that I/O is virtualized. +#make toolinfo +cmake --build . --target clean +cmake --build . +cmake --build . --target gpsbabel.html +cmake --build . --target gpsbabel.pdf +cmake --build . --target gpsbabel.org +cmake --build . --target check +#make -j 3 unix-gui +# FIXME: use hierarchical build +pushd gui +cmake . -G Ninja +cmake --build . +popd +# test for mangled encoding of command line arguments +./test_encoding_latin1 +./test_encoding_utf8 +#make torture +cmake --build . --target check-vtesto +# eat the verbose output from test-all, including crash.output +# this is a bit risky, if test-all generates an error we won't see what happened. +echo "test-all in progress... (read/write test between all possible formats)" +(LIBC_FATAL_STDERR_=1; export LIBC_FATAL_STDERR_; ./test-all -s -r reference/expertgps.gpx >/dev/null 2>&1) +# summarize the test-all results, and generate an error if a fatal error was +# detected by test-all. +./test-all -J diff --git a/tools/make_gpsbabel_org_wrapper.sh.in b/tools/make_gpsbabel_org_wrapper.sh.in new file mode 100755 index 000000000..fcf2b068a --- /dev/null +++ b/tools/make_gpsbabel_org_wrapper.sh.in @@ -0,0 +1,5 @@ +#!/bin/sh +set -e + +web=${WEB:-@WEB@} +"@CMAKE_SOURCE_DIR@/tools/make_gpsbabel_org.sh" "${web}" "@DOCVERSION@" diff --git a/tools/make_windows_release.ps1 b/tools/make_windows_release.ps1 index 7c5466230..32e8a0f5f 100755 --- a/tools/make_windows_release.ps1 +++ b/tools/make_windows_release.ps1 @@ -108,8 +108,7 @@ Copy-Item "$($gui_build_dir)\release\GPSBabelFE.exe" "$($gui_build_dir)\package\ & "$($windeployqt)" --verbose 1 --plugindir package\plugins package\GPSBabelFE.exe package\GPSBabel.exe if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) } if ($buildinstaller -eq "true") { - Set-Location "$($gpsbabel_src_dir)\gui" - & "$($iscc)" /Dpackage_dir="$($gui_build_dir)\package" setup.iss + & "$($iscc)" /Dpackage_dir="$($gui_build_dir)\package" /Dsource_dir="$($gpsbabel_src_dir)\gui" setup.iss if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) } } Set-Location "$($gpsbabel_src_dir)" diff --git a/vtesto b/vtesto index d20f84dec..0debc413d 100755 --- a/vtesto +++ b/vtesto @@ -22,12 +22,12 @@ BASEPATH=`dirname $0` # valgrind 3.11.0 has this problem with Qt 5.12.1. # It is unknown if 3.12.0 has this problem with Qt 5.12.1. # valgrind 3.13.0 does not have this problem with Qt 5.12.1. -# valgrind 3.11.0 is find with Qt 5.9.7. +# valgrind 3.11.0 is fine with Qt 5.9.7. # vex amd64->IR: unhandled instruction bytes: 0xF 0xC7 0xF2 0xB9 0x1 0x0 0x0 0x0 vgmajor=$(valgrind --version| cut -d- -f 2 | cut -d. -f 1) vgminor=$(valgrind --version| cut -d- -f 2 | cut -d. -f 2) if [ ${vgmajor} -lt 3 ]; then - vg_vesion_warning + vg_version_warning fi if [ ${vgmajor} -eq 3 ] ; then if [ ${vgminor} -le 12 ]; then @@ -35,26 +35,28 @@ if [ ${vgmajor} -eq 3 ] ; then fi fi -# newer versons of Qt, e.g. 5.12.x, use a JIT compiler for QRegularExpression. +# newer versions of Qt, e.g. 5.12.x, use a JIT compiler for QRegularExpression. # JITs use of self-modifying code can confuse valgrind. # We disable JIT with this environmental variable to keep valgrind happy. # https://doc.qt.io/qt-5/qregularexpression.html#debugging-code-that-uses-qregularexpression export QT_ENABLE_REGEXP_JIT=0 -while getopts "lj:" opt; do +while getopts "lj:p:" opt; do case $opt in l) OPTS="--leak-check=full --show-reachable=yes --num-callers=24 --suppressions=${BASEPATH}/gpsbabel.supp" ; QUIET="";; j) LOG=$OPTARG;; + p) PNAME="$OPTARG";; esac done shift $(($OPTIND -1)) +PNAME=${PNAME:-./gpsbabel} if [ "x$LOG" = "x" ]; then - PNAME="valgrind $OPTS --error-exitcode=125 $QUIET ./gpsbabel" ${BASEPATH}/testo $* + ${BASEPATH}/testo -v "valgrind $OPTS --error-exitcode=125 $QUIET" -p "$PNAME" $* else # By default valgrind output goes to file descriptor 2, stderr. # Some of our tests redirect file descriptor 2 to a file and compare it to an expected result. # These compares will fail if valgrind sends output to file descriptor 2. # This option avoids those valgrind induced miscompares by using an alternate file descriptor. - PNAME="valgrind $OPTS --error-exitcode=125 $QUIET --log-fd=3 ./gpsbabel" ${BASEPATH}/testo $* 3>$LOG + ${BASEPATH}/testo -v "valgrind $OPTS --error-exitcode=125 $QUIET --log-fd=3" -p "$PNAME" $* 3>$LOG fi diff --git a/win32/gpsbabel.rc b/win32/gpsbabel.rc index 003e27ae0..4b660c4d9 100644 --- a/win32/gpsbabel.rc +++ b/win32/gpsbabel.rc @@ -1,5 +1,5 @@ #include -#include "../gbversion.h" +#include "gbversion.h" IDI_ICON1 ICON "gpsbabel.ico" -- 2.30.2